/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import slcu.model.InscripcionDisciplina;
import slcu.model.InscripcionDisciplinaModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the InscripcionDisciplina service. Represents a row in the &quot;SLCU_InscripcionDisciplina&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link slcu.model.InscripcionDisciplinaModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link InscripcionDisciplinaImpl}.
 * </p>
 *
 * @author tito
 * @see InscripcionDisciplinaImpl
 * @see slcu.model.InscripcionDisciplina
 * @see slcu.model.InscripcionDisciplinaModel
 * @generated
 */
public class InscripcionDisciplinaModelImpl extends BaseModelImpl<InscripcionDisciplina>
	implements InscripcionDisciplinaModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a Inscripcion model instance should use the {@link slcu.model.InscripcionDisciplina} interface instead.
	 */
	public static final String TABLE_NAME = "SLCU_InscripcionDisciplina";
	public static final Object[][] TABLE_COLUMNS = {
			{ "inscripcionId", Types.BIGINT },
			{ "numeroDocumento", Types.VARCHAR },
			{ "cue", Types.BIGINT },
			{ "disciplinaId", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table SLCU_InscripcionDisciplina (inscripcionId LONG not null primary key,numeroDocumento VARCHAR(75) null,cue LONG,disciplinaId LONG)";
	public static final String TABLE_SQL_DROP = "drop table SLCU_InscripcionDisciplina";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.slcu.model.InscripcionDisciplina"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.slcu.model.InscripcionDisciplina"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.slcu.model.InscripcionDisciplina"),
			true);
	public static long CUE_COLUMN_BITMASK = 1L;
	public static long DISCIPLINAID_COLUMN_BITMASK = 2L;
	public static long NUMERODOCUMENTO_COLUMN_BITMASK = 4L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.slcu.model.InscripcionDisciplina"));

	public InscripcionDisciplinaModelImpl() {
	}

	public long getPrimaryKey() {
		return _inscripcionId;
	}

	public void setPrimaryKey(long primaryKey) {
		setInscripcionId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_inscripcionId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return InscripcionDisciplina.class;
	}

	public String getModelClassName() {
		return InscripcionDisciplina.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("inscripcionId", getInscripcionId());
		attributes.put("numeroDocumento", getNumeroDocumento());
		attributes.put("cue", getCue());
		attributes.put("disciplinaId", getDisciplinaId());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long inscripcionId = (Long)attributes.get("inscripcionId");

		if (inscripcionId != null) {
			setInscripcionId(inscripcionId);
		}

		String numeroDocumento = (String)attributes.get("numeroDocumento");

		if (numeroDocumento != null) {
			setNumeroDocumento(numeroDocumento);
		}

		Long cue = (Long)attributes.get("cue");

		if (cue != null) {
			setCue(cue);
		}

		Long disciplinaId = (Long)attributes.get("disciplinaId");

		if (disciplinaId != null) {
			setDisciplinaId(disciplinaId);
		}
	}

	public long getInscripcionId() {
		return _inscripcionId;
	}

	public void setInscripcionId(long inscripcionId) {
		_inscripcionId = inscripcionId;
	}

	public String getNumeroDocumento() {
		if (_numeroDocumento == null) {
			return StringPool.BLANK;
		}
		else {
			return _numeroDocumento;
		}
	}

	public void setNumeroDocumento(String numeroDocumento) {
		_columnBitmask |= NUMERODOCUMENTO_COLUMN_BITMASK;

		if (_originalNumeroDocumento == null) {
			_originalNumeroDocumento = _numeroDocumento;
		}

		_numeroDocumento = numeroDocumento;
	}

	public String getOriginalNumeroDocumento() {
		return GetterUtil.getString(_originalNumeroDocumento);
	}

	public long getCue() {
		return _cue;
	}

	public void setCue(long cue) {
		_columnBitmask |= CUE_COLUMN_BITMASK;

		if (!_setOriginalCue) {
			_setOriginalCue = true;

			_originalCue = _cue;
		}

		_cue = cue;
	}

	public long getOriginalCue() {
		return _originalCue;
	}

	public long getDisciplinaId() {
		return _disciplinaId;
	}

	public void setDisciplinaId(long disciplinaId) {
		_columnBitmask |= DISCIPLINAID_COLUMN_BITMASK;

		if (!_setOriginalDisciplinaId) {
			_setOriginalDisciplinaId = true;

			_originalDisciplinaId = _disciplinaId;
		}

		_disciplinaId = disciplinaId;
	}

	public long getOriginalDisciplinaId() {
		return _originalDisciplinaId;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			InscripcionDisciplina.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public InscripcionDisciplina toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (InscripcionDisciplina)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		InscripcionDisciplinaImpl inscripcionDisciplinaImpl = new InscripcionDisciplinaImpl();

		inscripcionDisciplinaImpl.setInscripcionId(getInscripcionId());
		inscripcionDisciplinaImpl.setNumeroDocumento(getNumeroDocumento());
		inscripcionDisciplinaImpl.setCue(getCue());
		inscripcionDisciplinaImpl.setDisciplinaId(getDisciplinaId());

		inscripcionDisciplinaImpl.resetOriginalValues();

		return inscripcionDisciplinaImpl;
	}

	public int compareTo(InscripcionDisciplina inscripcionDisciplina) {
		long primaryKey = inscripcionDisciplina.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		InscripcionDisciplina inscripcionDisciplina = null;

		try {
			inscripcionDisciplina = (InscripcionDisciplina)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = inscripcionDisciplina.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		InscripcionDisciplinaModelImpl inscripcionDisciplinaModelImpl = this;

		inscripcionDisciplinaModelImpl._originalNumeroDocumento = inscripcionDisciplinaModelImpl._numeroDocumento;

		inscripcionDisciplinaModelImpl._originalCue = inscripcionDisciplinaModelImpl._cue;

		inscripcionDisciplinaModelImpl._setOriginalCue = false;

		inscripcionDisciplinaModelImpl._originalDisciplinaId = inscripcionDisciplinaModelImpl._disciplinaId;

		inscripcionDisciplinaModelImpl._setOriginalDisciplinaId = false;

		inscripcionDisciplinaModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<InscripcionDisciplina> toCacheModel() {
		InscripcionDisciplinaCacheModel inscripcionDisciplinaCacheModel = new InscripcionDisciplinaCacheModel();

		inscripcionDisciplinaCacheModel.inscripcionId = getInscripcionId();

		inscripcionDisciplinaCacheModel.numeroDocumento = getNumeroDocumento();

		String numeroDocumento = inscripcionDisciplinaCacheModel.numeroDocumento;

		if ((numeroDocumento != null) && (numeroDocumento.length() == 0)) {
			inscripcionDisciplinaCacheModel.numeroDocumento = null;
		}

		inscripcionDisciplinaCacheModel.cue = getCue();

		inscripcionDisciplinaCacheModel.disciplinaId = getDisciplinaId();

		return inscripcionDisciplinaCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(9);

		sb.append("{inscripcionId=");
		sb.append(getInscripcionId());
		sb.append(", numeroDocumento=");
		sb.append(getNumeroDocumento());
		sb.append(", cue=");
		sb.append(getCue());
		sb.append(", disciplinaId=");
		sb.append(getDisciplinaId());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(16);

		sb.append("<model><model-name>");
		sb.append("slcu.model.InscripcionDisciplina");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>inscripcionId</column-name><column-value><![CDATA[");
		sb.append(getInscripcionId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numeroDocumento</column-name><column-value><![CDATA[");
		sb.append(getNumeroDocumento());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>cue</column-name><column-value><![CDATA[");
		sb.append(getCue());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>disciplinaId</column-name><column-value><![CDATA[");
		sb.append(getDisciplinaId());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = InscripcionDisciplina.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			InscripcionDisciplina.class
		};
	private long _inscripcionId;
	private String _numeroDocumento;
	private String _originalNumeroDocumento;
	private long _cue;
	private long _originalCue;
	private boolean _setOriginalCue;
	private long _disciplinaId;
	private long _originalDisciplinaId;
	private boolean _setOriginalDisciplinaId;
	private long _columnBitmask;
	private InscripcionDisciplina _escapedModelProxy;
}